﻿using Dataforge.PrismAvalonExtensions.Regions;
using Fluent;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.UnityExtensions;
using Microsoft.Practices.ServiceLocation;
using SampleApplication2.Regions;
using SampleApplication2.Views.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Xceed.Wpf.AvalonDock;

namespace SampleApplication2
{
  public class AppBootstrapper : UnityBootstrapper
  {
    protected override DependencyObject CreateShell()
    {
      return new MainWindow();
    }

    protected override void InitializeShell()
    {
      base.InitializeShell();
      Application.Current.MainWindow = (Window)this.Shell;
      Application.Current.MainWindow.Show();
    }

    protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
    {
      //NOTE: Add our Custom Region Adapters
      RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();
      IRegionBehaviorFactory factory = ServiceLocator.Current.GetInstance<IRegionBehaviorFactory>();
      
      //Avalondock
      mappings.RegisterMapping(typeof(DockingManager), new DockingManagerRegionAdapter(factory));
      
      //Fluent Ribbon
      mappings.RegisterMapping(typeof(Ribbon), new RibbonRegionAdapter(factory));
      return mappings;
    }
  }
}
